<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <meta name="renderer" content="webkit">
    <title>修改员工信息</title>
    <!-- 公共样式 开始 -->
    <link rel="stylesheet" type="text/css" href="../../css/base.css">
    <link rel="stylesheet" type="text/css" href="../../fonts/iconfont.css">
    <script type="text/javascript" src="../../framework/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../layui/css/layui.css">
    <script type="text/javascript" src="../../layui/layui.js"></script>
    <script src="../../framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
    <!-- 公共样式 结束 -->

    <style>
        .layui-form{
            margin-right: 30%;
        }
    </style>

</head>
<body>

<hr style="color: #0e5fa6">

<form class="layui-form" th:action="@{/empl/update2}" lay-filter="staffform">
    <!--id-->
    <div class="layui-form-item">
        <label class="layui-form-label">工号ID(不可修改)</label>
        <div class="layui-input-block">
            <input type="text" name="staff_id" th:value="${staff.staff_id}"  lay-verify="required" class="layui-input"  disabled="">
        </div>
    </div>

    <!--账号-->
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
            <input type="text" name="saccount" th:value="${staff.saccount}" lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--密码-->
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="spassword" th:value="${staff.spassword}" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--姓名-->
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="sname" th:value="${staff.sname}" lay-verify="required" lay-reqtext="姓名不能为空" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--年龄-->
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">年龄</label>
            <div class="layui-input-inline">
                <input type="tel" name="sage" th:value="${staff.sage}" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <!--电话-->
        <div class="layui-inline">
            <label class="layui-form-label">预留手机号</label>
            <div class="layui-input-inline">
                <input type="tel" name="sphone" th:value="${staff.sphone}" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <!--性别-->
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="ssex" value="男" title="男" th:checked="${staff.ssex=='男'}">
            <input type="radio" name="ssex" value="女" title="女" th:checked="${staff.ssex=='女'}">
        </div>
    </div>


    <!--身份证-->
    <div class="layui-form-item">
        <label class="layui-form-label">验证身份证</label>
        <div class="layui-input-block">
            <input type="text" name="scard" th:value="${staff.scard}" lay-verify="identity|identity" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>

    <!--职务-->
    <div class="layui-form-item">
        <label class="layui-form-label">职务</label>
        <div class="layui-input-block">
            <select name="role_id" lay-filter="aihao">

                <option th:selected="${role.role_id==staff.role_id}" th:each="role:${roles}" th:value="${role.role_id}" th:text="${role.role}"></option>
            </select>
        </div>
    </div>
    <!--部门-->
        <div class="layui-form-item">
            <label class="layui-form-label">所属部门</label>
            <div class="layui-input-block">
                <select name="department_id" lay-filter="aihao">

                    <option th:selected="${dep.department_id == staff.department_id}" th:each="dep:${departments}" th:value="${dep.department_id}" th:text="${dep.dname}"></option>
                </select>
            </div>
        </div>

    <!--提交-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="submit" class="layui-btn" th:value="修改">

        </div>
    </div>

</form>
<!--表单验证-->
<script>

    layui.use(['form', 'layedit'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit;


        //自定义验证规则
        form.verify({
            account: function(value){
                if(value.length < 5){
                    return '账号至少5个字符';
                }
            }
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]

        });

    })
</script>


</body>
</html>